﻿using HPIT_Library_Modal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HPIT_Library
{
    public partial class inboundAdd : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.DataSource = HPIT_Library_BLL.bookManger.Select();
                DropDownList1.DataBind();
                DropDownList2.DataSource = HPIT_Library_BLL.userManger.Select();
                DropDownList2.DataBind();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {


            BorrowBooks borrowBooks = new BorrowBooks()
            {
                BookId = Convert.ToInt32(DropDownList1.SelectedValue),
                BookMemberId = Convert.ToInt32(DropDownList2.SelectedValue),
            };
            if (HPIT_Library_BLL.BorrowBooksManger.Insert(borrowBooks)>0)
            {
                Response.Write("<script>alert('添加成功');location.href='inbound.aspx'</script>");
            }
        }
    }
}